#pragma once
#include <iostream>

#include "hash.h"

void test1()
{
	MyHash::HashTable<int, int> hash1;
	for (int i = 100;i < 200;i++)
	{
		hash1.insert({ i,i });
	}
	for (int i = 1100;i < 1200;i++)
	{
		hash1.insert({ i,i });
	}
	for (int i = 2100;i < 2200;i++)
	{
		hash1.insert({ i,i });
	}
	for (int i = 3100;i < 3200;i++)
	{
		hash1.insert({ i,i });
	}
	for (int i = 4100;i < 4200;i++)
	{
		hash1.insert({ i,i });
	}
	for (int i = 5100;i < 5200;i++)
	{
		hash1.insert({ i,i });
	}
	std::cout << hash1.GetCapacity() << std::endl;
}
void test2()
{
	MyHash::HashTable<std::string, std::string> hash1;
	std::string str[100];
	std::string strmod1 = "poiuytrewq";
	std::string strmod2 = "asdfghjklz";
	std::string strmod3 = "xcvbnm1234";

	for (int i = 0;i < 10;i++)
	{
		str[i] = strmod1[i] + strmod1[i];
		hash1.insert({ str[i] ,str[i] });
		std::cout << str[i] << std::endl;
	}
	for (int i = 0;i < 10;i++)
	{
		str[i] = strmod1[i] + strmod2[i];
		hash1.insert({ str[i] ,str[i] });
		std::cout << str[i] << std::endl;
	}
	for (int i = 0;i < 10;i++)
	{
		str[i] = strmod1[i] + strmod3[i];
		hash1.insert({ str[i] ,str[i] });
		std::cout << str[i] << std::endl;
	}
	for (int i = 0;i < 10;i++)
	{
		str[i] = strmod2[i] + strmod1[i];
		hash1.insert({ str[i] ,str[i] });
		std::cout << str[i] << std::endl;
	}
	for (int i = 0;i < 10;i++)
	{
		str[i] = strmod2[i] + strmod2[i];
		hash1.insert({ str[i] ,str[i] });
		std::cout << str[i] << std::endl;
	}
	for (int i = 0;i < 10;i++)
	{
		str[i] = strmod2[i] + strmod3[i];
		hash1.insert({ str[i] ,str[i] });
		std::cout << str[i] << std::endl;
	}
	for (int i = 0;i < 10;i++)
	{
		str[i] = strmod3[i] + strmod1[i];
		hash1.insert({ str[i] ,str[i] });
		std::cout << str[i] << std::endl;
	}
	for (int i = 0;i < 10;i++)
	{
		str[i] = strmod3[i] + strmod2[i];
		hash1.insert({ str[i] ,str[i] });
		std::cout << str[i] << std::endl;
	}
	for (int i = 0;i < 10;i++)
	{
		str[i] = strmod3[i] + strmod3[i];
		hash1.insert({ str[i] ,str[i] });
		std::cout << str[i] << std::endl;
	}
	for (int i = 0;i < 10;i++)
	{
		str[i] = strmod1[i] + strmod2[i] + strmod3[i];
		hash1.insert({ str[i] ,str[i] });
		std::cout << str[i] << std::endl;
	}
	std::cout << hash1.GetCapacity() << std::endl;
	for (auto it : hash1._hash)
	{
		std::cout << it._kv.second << "---";
	}
}



struct Date
{
	int _year;
	int _day;
	int _hour;
};

struct HashFuncDate
{
	size_t operator()(const Date& date)
	{
		size_t key = 0;
		key += date._year * 131;
		key += date._day * 132;
		key += date._hour * 133;
		return (size_t)key;
	}
};

struct HashEqualDate
{
	bool operator()(const Date& date1, const Date& date2)
	{
		return ((date1._year == date2._year) && (date1._day == date2._day) && (date1._hour == date2._hour));
	}
};
void test3()
{
	MyHash::HashTable<Date, Date, HashFuncDate, HashEqualDate> hash1;
	hash1.insert({ {2020,12,10},{2020,12,10} });
	hash1.insert({ {2020,10,12},{2020,10,12} });
	hash1.insert({ {2020,9,8},{2020,9,8} });
	hash1.insert({ {2020,8,9},{2020,8,9} });

}






int main()
{
	test1();
	test2();
	test3();
	return 0;
}